home *** CD-ROM | disk | FTP | other *** search
- #ifndef __InputSprocketDriver__
- #define __InputSprocketDriver__
-
-
- /*
- * InputSprocketDriver.h
- *
- * Copyright (c) Apple Computer 1995, 1996 All Rights Reserved
- *
- */
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #include "InputSprocket.h"
- #include <Types.h>
- #include <Icons.h>
- #include <Dialogs.h>
-
- /*
- *
- * this function will plot on icon suite of the applications
- *
- */
-
- OSErr ISpPlotAppIconSuite(const Rect *theRect,
- IconAlignmentType align,
- IconTransformType transform,
- short iconSuiteResourceId);
-
- typedef enum
- {
- kISpSelector_Init =1,
- kISpSelector_Stop,
- kISpSelector_GetSize,
- kISpSelector_HandleEvent,
- kISpSelector_Show,
- kISpSelector_Hide,
- kISpSelector_BeginConfiguration,
- kISpSelector_EndConfiguration,
- kISpSelector_GetIcon,
- kISpSelector_GetState,
- kISpSelector_SetState,
- kISpSelector_Dirty,
- kISpSelector_SetActive
- } ISpMetaHandlerSelector;
-
-
- /*
- *
- * typedefs for the function pointers the metahandler may return
- *
- */
-
- // a generic driver function pointer
- typedef OSStatus (* ISpDriverFunctionPtr_Generic)(UInt32 refCon, ...);
-
- // the meta handler pointer
- typedef ISpDriverFunctionPtr_Generic (* ISpDriverFunctionPtr_MetaHandler)(UInt32 refCon, ISpMetaHandlerSelector);
-
- // the pointers you get through the meta handler
- typedef OSStatus (* ISpDriverFunctionPtr_Init)(UInt32 refCon, UInt32 count, ISpNeed needs[], ISpElementReference virtualElements[],
- Boolean used[], OSType appCreatorCode, OSType subCreatorCode,
- UInt32 stateLength, void *state);
- typedef OSStatus (* ISpDriverFunctionPtr_Stop)(UInt32 refCon);
- typedef OSStatus (* ISpDriverFunctionPtr_GetSize)(UInt32 refCon, Point *minimum, Point *best);
- typedef OSStatus (* ISpDriverFunctionPtr_HandleEvent)(UInt32 refCon, EventRecord *theEvent, Boolean *handled);
- typedef OSStatus (* ISpDriverFunctionPtr_Show)(UInt32 refCon, DialogPtr theDialog, short dialogItemNumber);
- typedef OSStatus (* ISpDriverFunctionPtr_Hide)(UInt32 refCon);
- typedef OSStatus (* ISpDriverFunctionPtr_BeginConfiguration)(UInt32 refCon, UInt32 count, ISpNeed needs[]);
- typedef OSStatus (* ISpDriverFunctionPtr_EndConfiguration)(UInt32 refCon, Boolean accept);
- typedef OSStatus (* ISpDriverFunctionPtr_GetIcon)(UInt32 refCon, short *iconSuiteResourceId);
- typedef OSStatus (* ISpDriverFunctionPtr_GetState)(UInt32 refCon, UInt32 buflen, void *buffer, UInt32 *length);
- typedef OSStatus (* ISpDriverFunctionPtr_SetState)(UInt32 refCon, UInt32 length, void *buffer);
- typedef OSStatus (* ISpDriverFunctionPtr_Dirty)(UInt32 refCon, Boolean *dirty);
- typedef OSStatus (* ISpDriverFunctionPtr_SetActive)(UInt32 refCon, Boolean active);
-
- // ********************* driver level functions *********************
-
-
- /*
- *
- * ISpDevice_New
- *
- * This creates a new device from the device definition structure and returns
- * the result into the device reference.
- *
- * Returns Codes
- * paramErr
- * out of memory
- *
- * Specical Considerations
- * may not be done at interrupt time
- */
-
- OSStatus ISpDevice_New( const ISpDeviceDefinition *inStruct,
- ISpDriverFunctionPtr_MetaHandler metaHandler,
- UInt32 refCon,
- ISpDeviceReference *outReference);
-
- /*
- * ISpDevice_Dispose
- *
- * This disposes an existing device.
- *
- * Returns Codes
- * paramErr
- *
- * Special Considerations
- * May not be done at interrupt time
- *
- */
-
- OSStatus ISpDevice_Dispose(ISpDeviceReference inReference);
-
-
- /*
- *
- * ISpElementDefinitionStruct
- *
- * This is the structure that defines everything static about this
- * element. For each element on your device you will need to
- * fill in one of these structures when your driver loads.
- *
- */
-
- typedef struct ISpElementDefinitionStruct
- {
- ISpDeviceReference device; // device this element belongs to
- UInt32 group; // group this element belongs to or 0
-
- Str63 theString; // a string that is a human readable identifier for this element, internationalization ?
-
- ISpElementKind kind;
- ISpElementLabel label;
-
- void *configInfo; // a pointer to the buffer containing the configuration information for this element
- UInt32 configInfoLength; // length of that configuration info
-
- UInt32 dataSize; // the size of the data, so we can generate an appropriate buffer
-
- UInt32 reserved1;
- UInt32 reserved2;
- UInt32 reserved3;
- } ISpElementDefinitionStruct;
-
- /*
- *
- * ISpElement_New
- *
- * ISpElement_New takes an element definition struct and gives you back a element reference.
- * When you produce data you use that element reference to give the data to the system.
- *
- * Return Codes
- * paramErr
- * memory error
- *
- * Special Considerations
- * The ISpElement_New function may move or purge memory. Your application should not call this function
- * at interrupt time.
- *
- */
-
- OSStatus ISpElement_New(const ISpElementDefinitionStruct *inStruct, ISpElementReference *outElement);
-
- /*
- *
- * ISpElement_Dispose
- *
- * ISpElement_Dispose takes an element reference and deletes it.
- * You should call this function when your driver unloads.
- *
- * Return Codes
- * paramErr
- * memory error
- *
- * Special Considerations
- * The ISpElement_Dispose function may move or purge memory. Your application should not call this function
- * at interrupt time.
- *
- */
-
- OSStatus ISpElement_Dispose(ISpElementReference inElement);
-
- /*
- *
- * ISpElement_PushSimpleData
- *
- * ISpElement_PushSimpleData is the appropriate way to give the system data if your data fits exactly into
- * a 32 bit signed number. You pass the element reference that goes with the data, the data and the
- * AbsoluteTime that data was produced. If UpTime is not available you should fill time.lo with the
- * TickCount time and time.hi with 0.
- *
- * Return Codes
- * paramErr
- *
- */
-
- OSStatus ISpElement_PushSimpleData(ISpElementReference inElement, UInt32 data, const AbsoluteTime *time);
-
- /*
- *
- * ISpElement_PushComplexData
- *
- * ISpElement_PushComplexData is exactly like ISpElement_PushSimpleData except that it is appropriate for times
- * when your data does not fit into a signed 32 bit integer.
- *
- * Instead it takes the length of your data (which must match the datasize field of your ISpElementDefinitionStruct)
- * and a ptr to the devices state.
- *
- * Return Codes
- * paramErr
- *
- */
-
- OSStatus ISpElement_PushComplexData(ISpElementReference inElement, UInt32 buflen, void *state, const AbsoluteTime *time);
-
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif // __InputSprocketDriver__